package com.sdlg.controller;

import com.sdlg.pojo.Lry;
import com.sdlg.pojo.Member;
import com.sdlg.pojo.Order;
import com.sdlg.service.LryService;
import com.sdlg.service.MemberService;
import com.sdlg.util.PageResult;
import com.sdlg.util.QueryPageBean;
import com.sdlg.util.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/lry")
public class LryController {

    @Resource
    private LryService lryService;

    @RequestMapping("/findPage")
    public PageResult findPage(@RequestBody QueryPageBean queryPageBean){
        PageResult pageResult=lryService.findPage(queryPageBean);
        return pageResult;
    }
    @RequestMapping("/deleteInfoById")
    public Result deleteInfoById(@RequestParam("id")Integer id){
        Result result=lryService.deleteInfoById(id);
        return result;
    }
    @RequestMapping("/updateUser")
    @ResponseBody
    public Result saveUser(@RequestBody Lry lry){
        Result result = lryService.saveUser(lry);
        return  result;
    }

    @RequestMapping("/saveAllInfo")
    @ResponseBody
    public Result saveAllInfo(@RequestBody Lry lry){
        Result result = lryService.saveAllInfo(lry);
        return  result;
    }

    @RequestMapping("/bookRent")
    @ResponseBody
    public Result bookRent(Integer id, String bookid,@RequestBody Order order){
        Integer bookids=Integer.parseInt(bookid);
        Result result=lryService.bookRent(id,bookids,order);
        return result;
    }
    @RequestMapping("/getLryInfo")
    @ResponseBody
    public Result getLryInfo(Integer id){
        Result result=lryService.getLryInfo(id);
        return result;
    }

    @RequestMapping("/getLryAllInfo")
    @ResponseBody
    public Result getLryAllInfo(Integer id){
        Result result=lryService.getLryAllInfo(id);
        return result;
    }

    @RequestMapping("/savePassword")
    @ResponseBody
    public Result savePassword(Integer id,@RequestBody Lry lry){
        Result result=lryService.savePassword(id,lry);
        return result;
    }
}